package com.woniu.liuzhougov.systemSettings.controller;



import com.woniu.liuzhougov.systemSettings.pojo.SxType;
import com.woniu.liuzhougov.systemSettings.service.SxTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 事务类型管理
 * @Author: yuetang
 * @Date: 2019-04-23 16:08
 */
@Controller
public class SxTypeController {

    @Resource
    private SxTypeService sxTypeService;

    //全部查询
    @RequiresPermissions("SyType_selAll")
    @RequestMapping("/SxType/selAll")
    @ResponseBody
    public Map selAll(){
        List<SxType> list = sxTypeService.selAll();
        Map<String,Object> map = new HashMap<>();
        map.put("count",list.size());
        map.put("data",list);
        map.put("code",0);
        map.put("msg","");
        return map;
    }

    //添加类型
    @RequiresPermissions("SyType_insert")
    @RequestMapping("/SxType/insert")
    @ResponseBody
    public String insert(SxType sxType){
        return  sxTypeService.insert(sxType);
    }

    //修改类型
    @RequiresPermissions("SyType_update")
    @RequestMapping("/SxType/update")
    @ResponseBody
    public String update(SxType sxType){
        return sxTypeService.update(sxType);
    }

    //删除类型
    @RequiresPermissions("SyType_delete")
    @RequestMapping("/SxType/delete")
    @ResponseBody
    public String delete(int itemTypeId){
        return sxTypeService.delete(itemTypeId);
    }
}
